package org.ww.edu.controller;


import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.ww.commonutils.R;
import org.ww.edu.bean.Subject;
import org.ww.edu.bean.subject.OneSubject;
import org.ww.edu.service.SubjectService;

import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author ww
 * @since 2020-10-20
 */
@RestController
@RequestMapping("/edu/subject")
@Api(description = "课程分类管理")
public class SubjectController {

    @Autowired
    private SubjectService subjectService;

    /**
     * 添加课程分类
     * @param file
     * @return
     */
    @PostMapping("/addSubject")
    public R saveSubject(MultipartFile file){
        subjectService.addSubject(subjectService,file);
        return R.ok();
    }
    //获取所有的课程分类信息
    @GetMapping("/getAllSubject")
    public R getAllSubject(){
        List<OneSubject> list=subjectService.getAllSubject();
        return R.ok().data("list",list);
    }

}

